/*
 * ! TODO: 201 C:
 * /out/20201212/mhs/Section 200 -  Regulatory Affairs/SOP 201 -  Contacts and Submissions for FDA/C Accessing FDA Forms over the Internet
 * ! TODO: 601-1 A:
 * ./out/20201212/mhs/Section 600 -  Subject Management/SOP 601 - 1 -  Obtaining and Documenting Informed Consent - Assent/A Florida State Law for Surrogate Decision Makers for Health Care Treatment
 * url: https://www.fda.gov/about-fda/reports-manuals-forms/forms
 * ======================================
 * @Author: Duyb
 * @Date: 2020-12-14 15:32:46
 * @Last Modified by: Duyb
 * @Last Modified time: 2020-12-14 18:26:51
 */
const fs = require('fs');

const DATA = require('./msh-fda-data-20201214.json');
console.log(typeof DATA, Array.isArray(DATA));

/**
 * write json
 */
fs.writeFile(
  './msh-fda-data-format-20201214.json',
  JSON.stringify(DATA),
  (err) => {
    if (err) return console.error(err);
    console.log('success json');
  }
);

// const d2 = DATA.filter((item, i) => i < 10);

// .forEach((item, i) => {
//   setTimeout(() => {
//     const {
//       field_id,
//       form-number-rewrite, // id <a>
//       field_name,
//       field_issue_datetime,
//       field_document,
//       field_contact_formatted,
//       field_center,
//     } = item;
//   }, 1000 * i);
// });
// console.log(d2);
